<ui:composition template="/admin/templates/ui2.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:composite="http://java.sun.com/jsf/composite/primefaces"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:archer="http://java.sun.com/jsf/archer"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
	<f:metadata>
		<f:viewParam name="id" value="#{userHome.id}"></f:viewParam>
	</f:metadata>

	<ui:define name="content">
		<div class="entry">
			<p:toolbar styleClass="admin-nav-toolbar">
				<p:toolbarGroup>
					<h:outputLabel
						value="#{commonMsg.currentPositionLabel} #{userMsg.userManagerLabel}"></h:outputLabel>
				</p:toolbarGroup>
				<p:toolbarGroup align="right">
					<p:separator />
					<p:button outcome="/admin/user/userList"
						value="#{userMsg.userManagerLabel}"></p:button>
				</p:toolbarGroup>
			</p:toolbar>
			<p:spacer></p:spacer>
			<h:form id="form">
				<h:panelGrid columns="2" columnClasses="col1,col2" id="panel">

					<h:outputLabel value="#{userMsg.username}"></h:outputLabel>
					<h:inputText style="width:190px;height:18px;" maxlength="50"
						readonly="true" value="#{userHome.instance.username}">
					</h:inputText>

					<h:outputLabel value="#{userMsg.email}"></h:outputLabel>
					<h:inputText style="width:190px;height:18px;"
						value="#{userHome.instance.email}" maxlength="100"
						validatorMessage="#{userMsg.email}#{commonMsg.formatError}">
						<archer:validateInputRule ruleId="input.email"></archer:validateInputRule>
					</h:inputText>

					<h:outputLabel value="#{userMsg.realname}"></h:outputLabel>
					<h:inputText style="width:190px;height:18px;" maxlength="10"
						value="#{userHome.instance.realname}"></h:inputText>

					<h:outputLabel value="#{userMsg.sex}"></h:outputLabel>
					<h:selectOneMenu value="#{userHome.instance.sex}">
						<f:selectItem itemLabel="#{userMsg.male}" itemValue="M"></f:selectItem>
						<f:selectItem itemLabel="#{userMsg.female}" itemValue="F"></f:selectItem>
					</h:selectOneMenu>

					<h:outputLabel value="#{userMsg.status}"></h:outputLabel>
					<h:selectOneMenu value="#{userHome.instance.status}">
						<f:selectItem itemValue="1" itemLabel="#{userMsg.stautsEnable}"></f:selectItem>
						<f:selectItem itemValue="0" itemLabel="#{userMsg.stautsDisable}"></f:selectItem>
					</h:selectOneMenu>

					<h:outputLabel value="#{userMsg.mobileNumber}"></h:outputLabel>
					<h:inputText style="width:190px;height:18px;" maxlength="18"
						validatorMessage="#{userMsg.mobileNumber}#{commonMsg.formatError}"
						value="#{userHome.instance.mobileNumber}">
						<archer:validateInputRule ruleId="input.mobile"></archer:validateInputRule>
					</h:inputText>

					<h:outputLabel value="绑定IP"></h:outputLabel>
					<ui:fragment>
						<h:inputText style="width:190px;height:18px;" maxlength="18"
							value="#{userHome.instance.bindIP}">
						</h:inputText>
						为空则无登录ip限制；如果绑定多个ip，请用英文逗号分隔。
					</ui:fragment>

					<h:outputLabel value="#{userMsg.idCard}"></h:outputLabel>
					<h:inputText style="width:190px;height:18px;" maxlength="20"
						value="#{userHome.instance.idCard}"></h:inputText>

					<h:outputLabel value="#{userMsg.currentAddress}"></h:outputLabel>
					<h:inputText style="width:190px;height:18px;" maxlength="100"
						value="#{userHome.instance.currentAddress}"></h:inputText>

					<h:outputLabel value="#{userMsg.nickname}"></h:outputLabel>
					<h:inputText style="width:190px;height:18px;" maxlength="50"
						value="#{userHome.instance.nickname}"></h:inputText>

					<h:outputLabel value="#{userMsg.roleLabel}"></h:outputLabel>
					<h:selectManyCheckbox value="#{userHome.instance.roles}"
						layout="pageDirection" converter="archer.EntityConverter"
						collectionType="java.util.ArrayList">
						<f:selectItems value="#{roleList.allResultList}" var="role"
							itemLabel="#{role.name}[#{role.id}]" itemValue="#{role}"></f:selectItems>
					</h:selectManyCheckbox>

					<h:outputLabel value="#{commonMsg.actionLabel}"></h:outputLabel>
					<ui:fragment>
						<h:inputHidden value="#{userHome.instance.id}"></h:inputHidden>
						<p:commandButton id="saveBtn" action="#{userHome.modifyByAdmin}"
							ajax="false" value="#{commonMsg.saveLabel}"></p:commandButton>
						<p:commandButton type="reset" value="#{commonMsg.resetLabel}"></p:commandButton>
						<p:blockUI block="panel" trigger="saveBtn" />
					</ui:fragment>
				</h:panelGrid>

			</h:form>
		</div>
	</ui:define>
</ui:composition>

